import React from 'react';
import { Affix as AntdAffix } from 'antd';
import type { AffixProps as AntdAffixProps } from 'antd';
import { createStyles } from 'antd-style';

export interface AffixProps extends AntdAffixProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  affix: css`
    z-index: ${token.zIndexPopupBase};
  `,
}));

const Affix: React.FC<AffixProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const affixClassName = cx(
    className,
    customClassName,
    styles.affix
  );

  return <AntdAffix className={affixClassName} {...restProps} />;
};

export { Affix };
export default Affix;

